#!/usr/bin/python

header= """# gnuplot

#set title '%title'

set xlabel 'Cantidad de iteraciones'
set ylabel 'Error relativo'

set key left Left

set log

set style line 1 lt rgb "red" lw 2
set style line 2 lt rgb "blue" lw 2
set style line 3 lt rgb "brown" lw 2
set style line 4 lt rgb "black" lw 2
set style line 5 lt rgb "violet" lw 2
set style line 6 lt rgb "green" lw 2

plot \
'%file.csv' using 1:((column(2))) ls 1 title "Backward 0" with lines,\
'%file.csv' using 1:((column(3))) ls 2 title "Forward 0" with lines,\
'%file.csv' using 1:((column(4))) ls 3 title "Horn 0" with lines,\
'%file.csv' using 1:((column(5))) ls 4 title "Backward 1" with lines,\
'%file.csv' using 1:((column(6))) ls 5 title "Forward 1" with lines,\
'%file.csv' using 1:((column(7))) ls 6 title "Horn 1" with lines

pause mouse

# deja un png
set terminal epslatex dashed 
set output '%file.eps'
replot
"""
"""
#esto es lo que se usaba para los png
#en gnuplot 4.2 no anda
set terminal png \
font Verdana 12 size 600,500 \
transparent xffffff x000000 x202020 \
 x000000 x808080 xE0E0E0 x404040 x606060 xA0A0A0
 set output '%file.png'
 replot"""


files= []
for a in [0.01, 0.1, 0.5, 1, 10, 20]:
	for p in [5,10,15,20,50]:
		files.append("test_"+str(p)+".a_"+str(a))

for file in files:
	s= open(file + ".plot", "w")
	tmp_str= header.replace("%file", file).replace("%title", file)
	s.write(tmp_str)
	s.close()
